﻿using System;
using System.Collections;

namespace ConsoleApp7
{
    class Program
    {
        static void Main(string[] args)
        {
            Hashtable ht = new Hashtable();
            ht.Add(1, "西红柿炒鸡蛋");
            ht.Add(2, "红烧肉");
            ht.Add(3, "糖醋排骨");
            ht.Add(4, "可乐鸡翅");
            ht.Add(5, "山药排骨");
            Console.WriteLine("输入想吃的菜编号");
            int id = int.Parse(Console.ReadLine());
            bool flag = ht.ContainsKey(id); if (flag)
            {
                Console.WriteLine("你想吃的是：{0}", ht[id].ToString());
            }
            else
            { Console.WriteLine("没有你想吃的菜！"); }
            Console.WriteLine("所有菜如下：");
            foreach (DictionaryEntry d in ht)
            {
                int key = (int)d.Key; string value = d.Value.ToString();
                Console.WriteLine("菜单编号：{0}，菜名：{1}", key, value);
            }
        }
    }
}
